package ru.evga.billboard.graph.preference;

public class BooleanParam
    extends Param<Boolean>
{
    public BooleanParam(String key, Boolean defaultValue)
    {
        super(key, defaultValue);
    }

    public void fromString(String strValue)
    {
        if (strValue == null)
        {
            setValue(getDefaultValue());
        }
        else
        {
            try
            {
                setValue(Boolean.valueOf(strValue));
            }
            catch (Exception e)
            {
                setValue(getDefaultValue());
            }
        }
    }

    public String toString()
    {
        return String.valueOf(getValue());
    }
}
